package controler;

import java.awt.Image;
import java.awt.Toolkit;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.UnsupportedLookAndFeelException;
import view.base.TabsPanel;
import view.desktop.DesktopTabsPanel;

public class DesktopApplication {
    
    public static void main(String args[]) throws UnsupportedLookAndFeelException {
        view.base.LookAndFeel.set();
        
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);        
        frame.setTitle("PROVER");
        Image icon = Toolkit.getDefaultToolkit().getImage("tree_icon.png");
        frame.setIconImage(icon);
        
        TabsPanel tp = new DesktopTabsPanel("operators.txt");
        //tp = new DesktopTabsPanel("http://student.agh.edu.pl:80/~kamillop/operators.txt");
        frame.getContentPane().add(tp);
        
        frame.pack();
        frame.setVisible(true);
    }
    
	public static String loadFormula(String path) throws FileNotFoundException {
		BufferedReader in = new BufferedReader(new FileReader(path));
		String formula = "", buf;

		do {
			try {
				buf = in.readLine();
				if (buf != null) {
                    formula += buf;
                }
			} catch (IOException ioe) {
				buf = null;
			}
		} while (buf != null);

		return formula;
	}
}
